<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ include file="../../base.jsp"%>
<!DOCTYPE html>
<html>

<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>数据 - AdminLTE2定制版</title>
    <meta name="description" content="AdminLTE2定制版">
    <meta name="keywords" content="AdminLTE2定制版">
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 页面meta /-->
    <script src="../plugins/jQuery/jquery-2.2.3.min.js"></script>
</head>
<script>
    /*页面展示*/
    function view() {
        var id = getCheckId();
        if(id) {
            location.href="${ctx}/cargo/finance/toView.do?id="+id;
        }else{
            alert("请勾选待处理的记录，且每次只能勾选一个")
        }
    }
    /*委托单提交*/
    function submit() {
        var id = getCheckId();
        if(id) {
            location.href="${ctx}/cargo/finance/submit.do?id="+id;
        }else{
            alert("请勾选待处理的记录，且每次只能勾选一个")
        }
    }
    function cancel() {
        var id = getCheckId()
        if(id) {
            location.href="${ctx}/cargo/finance/cancel.do?id="+id;
        }else{
            alert("请勾选待处理的记录，且每次只能勾选一个")
        }
    }

    <%--单挑删除公司信息--%>
    function deleteById() {
        var id = getCheckId();
        if(id) {
            if(confirm("你确认要删除此条记录吗？")) {
                location.href="/cargo/finance/delete.do?id="+id;
            }
        }else{
            alert("请勾选待处理的记录，且每次只能勾选一个")
        }
    }

    <%--全选、全不选--%>
    /*function allCheck(flag){
        /!*测试*!/
        /!*alert(flag)*!/
        //获取元素名为ids的标签数组
        var itemArr = document.getElementsByName("ids");
        // 遍历数组,设置状态
        for(var i=0;i<itemArr.length;i++){
            // 给当前标签对象的checked属性设置值
            itemArr[i].checked = flag;
        }
    }*/

    <%--分页--%>
    /*$(function () {
        $("#pageSize").change(function () {
            var pageSize = $("#pageSize").val();
            location.href="${pageContext.request.contextPath}/cargo/finance/list.do?page=1&size="+pageSize;
        })
    });*/

    <%--根据下拉选项进行分页--%>
   /* $(function () {
        //获取下拉选项的所有内容
        var pageSize = document.getElementById("pageSize");
        //获取传递回来的对象中存的size
        var value = "${page.pageSize}";
        /!* alert(pageSize.options.length)*!/
        //遍历数组
        for(var i=0; i<pageSize.options.length; i++){
            //如果下拉选项的标签体内容与对象中的size一致
            if(pageSize.options[i].text === value){
                //添加selectd属性
                pageSize.options[i].selected="selected";
                break;
            }
        }
    })*/

</script>
<body>
<div id="frameContent" class="content-wrapper" style="margin-left:0px;">
    <section class="content-header">
        <h1>
            财务管理
            <small>财务管理</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="/home.do"><i class="fa fa-dashboard"></i> 首页</a></li>
        </ol>
    </section>
    <!-- 内容头部 /-->

    <!-- 正文区域 -->
    <section class="content">

        <!-- .box-body -->
        <div class="box box-primary">
            <div class="box-header with-border">
                <h3 class="box-title">财务报运单列表</h3>
            </div>

            <div class="box-body">

                <!-- 数据表格 -->
                <div class="table-box">

                    <!--工具栏-->
                    <div class="pull-left">
                        <div class="form-group form-inline">
                            <div class="btn-group">
                                <%----%>
<%--
                                <button type="button" class="btn btn-default" title="新建" onclick='location.href="${ctx}/cargo/finance/toAdd.do"'><i class="fa fa-file-o"></i> 新建</button>
--%>
                                <button type="button" class="btn btn-default" title="查看" onclick='view()'><i class="fa  fa-eye-slash"></i> 查看</button>
                                <button type="button" class="btn btn-default" title="删除" onclick='deleteById()'><i class="fa fa-trash-o"></i> 删除</button>
                                <button type="button" class="btn btn-default" title="刷新" onclick="window.location.reload();"><i class="fa fa-refresh"></i> 刷新</button>
                                <button type="button" class="btn btn-default" title="提交" onclick="submit()"><i class="fa fa-retweet"></i> 提交</button>
                                <button type="button" class="btn btn-default" title="取消" onclick="cancel()"><i class="fa fa-remove"></i> 取消</button>
                            </div>
                        </div>
                    </div>
                    <div class="box-tools pull-right">
                        <div class="has-feedback">
                            <input type="text" class="form-control input-sm" placeholder="搜索">
                            <span class="glyphicon glyphicon-search form-control-feedback"></span>
                        </div>
                    </div>
                    <!--工具栏/-->

                    <!--数据列表-->
                    <table id="dataList" class="table table-bordered table-striped table-hover dataTable">
                        <thead>
                        <tr>

                            <th class="" style="padding-right:0px;">
                                <input type="checkbox" name="selid" onclick="allCheck(this.checked)">
                            </th>
                            <th class="sorting">序号</th>

                            <th class="sorting">财务报运单号</th>
                            <th class="sorting">制单日期</th>
                            <th class="sorting">发票金额</th>
                            <th class="sorting">装运港</th>
                            <th class="sorting">卸货港</th>
                            <th class="sorting">装货日期</th>
                            <th class="sorting">有效日期</th>
                            <th class="sorting">份数</th>
                            <th class="sorting">运输方式</th>
                            <th class="sorting">公司名称</th>

                            <th class="text-center">状态</th>
                            <th class="text-center">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${pageList.list}" var="o" varStatus="status">
                            <tr>
                                <td><input type="checkbox" name="ids" value="${o.financeId}"/></td>
                                <td>${status.index+1}</td>
                                <td><a href="${ctx}/cargo/finance/toView.do?id=${o.financeId}">${o.financeId}</a></td>
                                <%--<td>${o.inputDate}</td>--%>
                                <td><fmt:formatDate value="${o.inputDate}" pattern="yyyy-MM-dd"/></td>
                                <td>${o.invoicemoney}</td>
                                <td>${o.portOfLoading}</td>
                                <td>${o.portOfDischarge}</td>
                                <td><fmt:formatDate value="${o.loadingdate}" pattern="yyyy-MM-dd"/></td>
                                <td><fmt:formatDate value="${o.limitdate}" pattern="yyyy-MM-dd"/></td>
                                <td>${o.copynum}</td>
                                <td>${o.ordertype}</td>
                                <td>${o.companyName}</td>

                                <td><c:if test="${o.state==0}">草稿</c:if>
                                    <c:if test="${o.state==1}"><font color="green">财务已审核</font></c:if>
                                    <c:if test="${o.state==2}"><font color="red">已上报</font></c:if>
                                    <c:if test="${o.state==3}"><font color="blue">已报运</font></c:if>
                                    <c:if test="${o.state==4}"><font color="orange"> home装箱</font></c:if>
                                    <c:if test="${o.state==5}"><font color="green">待正式装箱</font></c:if>
                                    <c:if test="${o.state==6}"><font color="green">装箱完成</font></c:if>
                                    <c:if test="${o.state==7}"><font color="green">待正式委托</font></c:if>
                                    <c:if test="${o.state==8}"><font color="green">委托完成</font></c:if>
                                    <c:if test="${o.state==9}"><font color="green">待开发票</font></c:if>
                                    <c:if test="${o.state==10}"><font color="green">已开发票</font></c:if>
                                    <c:if test="${o.state==11}"><font color="green">待审核财务</font></c:if>
                                    <c:if test="${o.state==12}"><font color="green">财务审核完毕</font></c:if>
                                    <c:if test="${o.state==13}"><font color="green">订单完成</font></c:if>
                                </td>
                                <td>
                                    <c:if test="${o.state >=1}">
                                        <a href="${ctx }/cargo/finance/toPrint.do?id=${o.financeId}">[打印]</a>
                                    </c:if>
                                    <c:if test="${o.state==0}">
                                        <a href="${ctx }/cargo/finance/toUpdate.do?id=${o.financeId}">[编辑]</a>
                                    </c:if>
                                </td>

                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
            </div>
            <!-- /.box-body -->

            <!-- .box-footer-->
            <div class="box-footer">
                <jsp:include page="../../common/page.jsp">
                    <jsp:param value="/cargo/finance/list.do" name="pageUrl"/>
                </jsp:include>
            </div>
        </div>
    </section>
</div>
</body>

</html>